package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.FollowResultBean;
import com.beiing.tianshuai.tianshuai.entity.MyAttentionBean;
import com.beiing.tianshuai.tianshuai.mine.model.MyAttentionModel;
import com.beiing.tianshuai.tianshuai.mine.model.MyAttentionModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.MyAttentionViewImpl;

/**
 * Created by Jinni on 2017/7/16 0016.
 */

public class MyAttentionPresenter extends BasePresenter implements MyAttentionPresenterImpl, MyAttentionModel.OnRequestListener {

    private MyAttentionViewImpl mAttentionView;
    private MyAttentionModelImpl mAttentionModel;

    public MyAttentionPresenter(MyAttentionViewImpl attentionView) {
        mAttentionView = attentionView;
        mAttentionModel = new MyAttentionModel(this);
    }

    @Override
    public void getMyAttentionResult(String id) {
        mAttentionView.showProgress();
        mAttentionModel.getMyAttentionResult(id);
    }

    @Override
    public void getMyFansResult(String id) {
        mAttentionView.showProgress();
        mAttentionModel.getMyFansResult(id);
    }

    @Override
    public void requestFollow(String mUid, MyAttentionBean.DataBean.ConcernBean bean, int position, int pageType) {
        mAttentionModel.requestFollow(mUid, bean, position, pageType);
    }

    @Override
    public void onSuccess(MyAttentionBean bean) {
        mAttentionView.hideProgress();
        mAttentionView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable e) {
        mAttentionView.hideProgress();
        mAttentionView.onRequestFailed(e);
    }

    @Override
    public void onFollowSuccess(FollowResultBean bean, int position, MyAttentionBean.DataBean.ConcernBean concernBean) {
        mAttentionView.onFollowSuccess(bean, position, concernBean);
    }

    @Override
    public void onFollowError(Throwable throwable) {
        mAttentionView.onFollowError(throwable);
    }
}
